<?php
include 'headers.php';
//print_r($_POST);
$res = $db->select_query('SELECT id, name, activity_date FROM activity WHERE activity_date >= "' . date('Y-m-d H:i:s') . '" AND id > ' . $_POST['id'] . ' ORDER BY activity_date ASC, id ASC LIMIT 10');

$countRow = mysql_num_rows($res);
if($countRow != 0)
{
    while($arr = $db->fetch($res))
    {
        $countReply = $db->num_rows('activity_reply', 'reply_id', 'activity_id = ' . $arr['id'] . '');
        ?>     
        <li data-ctype="activity" id="activity_<?php echo $arr['id']; ?>" last_id="<?php echo $arr['id']; ?>" data-corners="false" data-shadow="false" data-iconshadow="true" data-wrapperels="div" data-icon="arrow-r" data-iconpos="right" data-theme="c" class="ui-btn ui-btn-up-c ui-btn-icon-right ui-li-has-arrow ui-li ui-li-has-count ui-li-has-icon">
            <div class="ui-btn-inner ui-li">
                <div class="ui-btn-text">
                    <a rel="external" href="?q=activityDetail&activityId=<?php echo $arr['id']; ?>" class="ui-link-inherit">
                        <img src="images/pin.png" class="ui-li-icon  ui-li-thumb">
                        <div style="font-size:20px;"><?php echo $arr['name'] . ' :: ' . $arr['id']; ?></div>
                        <p style="margin-top:2px; font-size:12px;" class="ui-li-desc">วัน/เวลา : <?php echo $arr['activity_date']; ?></p>
                        <span class="ui-li-count ui-btn-up-c ui-btn-corner-all"><?php echo $countReply; ?></span>
                    </a>
                </div>
                <span class="ui-icon ui-icon-arrow-r ui-icon-shadow">&nbsp;</span>
            </div>
        </li>             
        <?php
    }
}
else
{
    echo '0';
}
?>